package com.along.game.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.along.framework.dao.base.IBaseDao;
import com.along.game.dao.PicDAO;
import com.along.game.model.InitDeskinfo;
import com.along.game.model.SmallStateinfo;
import com.along.game.model.UserInfo;

@Repository("picDAO")
public class PicDAOImpl implements PicDAO {
	
	@Resource(name="baseDao")
	private IBaseDao<InitDeskinfo,Long> dao;
	
	public void saveInitDesk(InitDeskinfo initDesk) {
		dao.getHibernateTemplate().saveOrUpdate(initDesk);
	}
	
	
	public InitDeskinfo getInitDeskByDeskId(String deskid) {
		  Object[] o = {deskid};
		    List l = dao.getHibernateTemplate().find("from SmallStateinfo where deskId=?", o);
		    if (l == null || l.isEmpty()) {
		      return null;
		    }
		    else {
		      return (InitDeskinfo) l.get(0);
		    }
	}
	

	
	
	public void delteDeskPic(InitDeskinfo initDesk) {
		dao.getHibernateTemplate().delete(initDesk);
	}
	
	
	
	


}
